import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()){
            String s=scanner.nextLine();
            List<String> list=new ArrayList<>();
            for(int i=0;i<s.length();i++){
                StringBuilder sb=new StringBuilder();
                while (i<s.length()&&((s.charAt(i)>='a'&&s.charAt(i)<='z')||(s.charAt(i)>='A'&&s.charAt(i)<='Z'))){
                    sb.append(s.charAt(i));
                    i++;
                }
                if(sb.length()==0){
                    continue;
                }
                list.add(sb.toString());
            }
            StringBuilder ret=new StringBuilder();
            for(int i=list.size()-1;i>=0;i--){
                if(i==0){
                    ret.append(list.get(i));
                }else{
                    ret.append(list.get(i)+" ");
                }
            }
            System.out.println(ret.toString());
        }
    }














//    public static void main(String[] args) {
//        Scanner scanner=new Scanner(System.in);
//        while (scanner.hasNext()){
//            String s=scanner.next();
//            String[] str=s.split("_");
//            StringBuilder sb=new StringBuilder();
//            for(int i=0;i<str.length;i++){
//                if(i==0){
//                    sb.append(str[i]);
//                }else{
//                    sb.append(Character.toUpperCase(str[i].charAt(0))+str[i].substring(1,str[i].length()));
//                }
//            }
//            System.out.println(sb.toString());
//        }
//    }
}
